<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<body>
<script type="text/html" id="toolbarDemo">
	<div class="layui-btn-container">
		<button class="layui-btn layui-btn-sm" lay-event="add_panel">新增</button>
  	</div>
</script>

	  	<fieldset class="layui-elem-field layui-field-title site-title">
			<legend><a name="fixbar" style="font-size: 16px; color: #ce2424;">课程信息</a></legend>
		</fieldset>
		<form class="layui-form" action="save" id="myForm" method="post" lay-filter="stuform">
			<div class="layui-form-item">
				<div class="layui-inline">
					<label class="layui-form-label">课程名称：</label>
					<div class="layui-input-block">
						<input type="text" name="courseName" id="courseName" value="${param.courseName}" class="layui-input" />
					</div>
				</div>
				<%-- <div class="layui-inline">
					<label class="layui-form-label">难易度：</label>
					<div class="layui-input-block">
						<input type="text" name="difficultylevel" id="difficultylevel" value="${param.difficultylevel}" class="layui-input" />
					</div>
				</div> --%>
				<div class="layui-inline">
					<button type="button" class="layui-btn layui-btn-danger" onclick="search()" >查询</button>
					<button type="button" class="layui-btn layui-btn-danger" onclick="empty()" >清空</button>
				</div>
			</div>
		</form>
	
	<table class="layui-hide" id="tbCurriculum" lay-filter="tbCurriculum"></table>
	
	<script type="text/javascript">
		var option={
			elem:'#tbCurriculum',
			title:'课程信息',
			path:'tbCurriculum',
			height:'full-265',
			id: 'tbCurriculum',
			addurl:'edit',
			where:{courseName:'${param.courseName}',difficultylevel:'${param.difficultylevel}'},
			toolbar:'#toolbarDemo',
			cols: [[
				{field: 'id', title: 'ID', hide: true, usersize: true, sort: true},
				{field: 'teachingUnit', title: '课程分类'},
				{field: 'courseName', title: '课程名称'},
				{field: 'overview', hide: true, title: '课程概述'},
				{field: 'content', hide: true, title: '课程内容'},
				{field: 'period', title: '课时（小时）'},
				{field: 'objective', hide: true, title: '课程目标'},
				{field: 'teacher', title: '教师', templet: function(d){
					return d.teacher?d.teacher.name: '';
				}},
				{fixed: 'right', title:'操作', toolbar: '#barDemo2', width:200}
			]] 
		}
		var currRow="${param.currRow==null?'null':param.currRow}";
		var limit=${param.limit==null?'null':param.limit};
		var page=${param.page==null?'null':param.page};
		var classTable=new LayUiTable(option,currRow,limit,page);
		classTable.init();
		
		
		//classTable.empty();
		
		function search(){
			classTable.search();
		}
		
		function empty(){
			classTable.empty();
		}
		
		/* layui.use("table", function(){
			var table = layui.table;
			table.on('tool(tbCurriculum)', function(obj){
				var checkStatus = table.checkStatus('tbCurriculum');
				var data = checkStatus.data;
			    if(obj.event === 'delete'){
				  	
			    } else if(obj.event === 'update_panel'){
			    	var id = data[0].id;
			    	classTable.edit_panel2(id);
			    }
			})
		}) */
		
	</script>
</body>
